<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateDistributionRulesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('distribution_rules', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('rule_name')     ->default(0)->comment('规则名称');
            $table->integer('grade')        ->default(0)->comment('级别,数字越大级别越高，一级一级往上升');
            $table->decimal('first_ratio')  ->default(0)->comment('一级分销提成比率');
            $table->decimal('secondary_ratio')->default(0)->comment('二级分销提成比率');
            $table->decimal('three_ratio')  ->default(0)->comment('三级分销提成比率');
            $table->integer('auto_upgrade')  ->default(0)->comment('自动升级：0不支持，1支持');
            $table->integer('is_default')   ->default(0)->comment('默认等级：0不是，1是');
            $table->integer('status')       ->default(0)->comment('状态：0关闭，1开启');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('distribution_rules');
    }
}
